Config
Base Config class for use with FzzyConfig
Implement a subclass of this base class, and include the config options you want as public non-final properties ("vars"). Register your config in the ConfigApi to benefit from auto-syncing to clients, auto-GUI generation, automatic update saving, and more. Recommended registration pattern is
Kotlin:
var myConfig = ConfigApi.registerAndLoadConfig { MyConfigClass() }
Java:
MyConfig myConfig = ConfigApi.registerAndLoadConfig(() -> new MyConfig())
For version control support, annotate your config classes with a Version. As you update the config, update this version number and implement any needed manual adjustments to update
FzzyConfig can interact with three types of vars
{Not Recommended} "Bare" properties. Your standard property (ex:
var myOption = 5
). These properties won't be validated, corrected, and won't show up in Config Guis. For an internal server-only setting, this may be an appropriate choice, but generally strongly recommended to use a Validation wrapper.{Recommended} ConfigSection. Inner "sections" of a Config. Can be used to organize related topics of a larger config. Interfaces with the auto-GUI system as a "sub-layer". A button will allow the user to drill down into the section, showing only the options for that section. Sections automatically de/serialize updated entries back to the server/clients like #3 below.
{Recommended} ValidatedField properties, or custom Entry implementations. These properties offer a wide array of powerful benefits to the user and the implementer
Validation. Inputs are automatically validated
Correction. Invalid inputs are automatically corrected, reverted, or skipped.
Gui Support. FzzyConfigs auto-generated GUIs only take Entry's into account when building their GUI layers. The internal validation is used to build meaningful and helpful widgets with helpful tooltips and auto-suggestions, where possible. Entry's are auto-synced back to the server and other listening clients based on user permission level
Author
fzzyhmstrs
Since
0.2.0
Parameters
Identifier - The identifier of this config. Common groups of namespace will be the first "layer" of the Config GUI where applicable (all configs of the same namespace in one group), so it's recommended to use one unified namespace (modid, generally)
String, optional - the name of the config, this will be the file name (sans file extension). By default, this is defined from the path of the config identifier. NOTE: Do not add a file type to this name. That is done automatically where needed
String, optional - the subfolder inside the root config folder the file will be saved in. By default, this is defined from the namespace of the config identifier. Can be "", which will put the file in the root config folder.
String, optional - puts the config into a sub-subfolder inside the subfolder specified in folder. Does not affect ID or GUI layout
See also
Constructors
Properties
Functions
Anchor modifier method for a config. By default, provides a folder icon decoration to the base anchor. You can provide a custom icon if you want a special icon for the config in the goto menu. If your config has a long name, you may also want to create and provide a shortened "summary" name for a goto link.
The default vanilla permission level of entries in this config. Users will need to have at least this permission level to modify entries for synced configs except for entries that are me.fzzyhmstrs.fzzy_config.annotations.ClientModifiable or me.fzzyhmstrs.fzzy_config.annotations.NonSync
The translated Text description from the descriptionKey. Falls back to an empty string so no tooltip is rendered.
Whether this Translatable has a valid description
Whether this Translatable has a valid translation
Runs on the logical client after a config is synced from the server. This occurs when the player is logging in and when datapacks are reloaded. This is distinct from onUpdateClient, which fires when changes are made to a config in-game, which are also synced. This is the initial sync of the entire config state.
Runs on the logical server as config is about to be synced to a client. This occurs when the player is logging in and when datapacks are reloaded. This is distinct from onUpdateServer, which fires when changes are made to a config in-game, which are also synced. This is the initial sync of the entire config state.
Runs on the logical client after the config is updated. Typically, this is when the user closes the config screen or applies changes, but also occurs after a connected client recieves a S2C update. This is distinct from onSyncClient, which fires when the entire config state is synced on login/reload. This handles chnages made in-game.
Runs on the logical server after an updated config is prepared for saving. Typically, this will be after a config update is received from a connected client, and that update passes permission checks.
The translated Text description from the descriptionKey. Falls back to an empty string so no tooltip is rendered.
The translated Text name from the translationKey. Falls back to the implementing classes Simple Name (non-translated)